KitePlayerPictureInPicture
Puts a KitePlayer in the small floating window, and lets that window drive it, on iOS and macOS.
The system offers this only to a player that draws into a sample buffer display layer, which is what SampleBufferVideoRenderer in the output module produces. Pair the view with that renderer first, then build one of these over the same layer. On macOS, an AppKitWindow built with the sample buffer surface hosts such a layer.
What this keeps in step, so the window never shows a stale state:
The play button and the range. The window reads them again whenever the player's status, duration or seekability changes. A source that cannot seek hides the skip buttons.
The progress bar. The window reads the layer's clock, so this gives the layer a clock and keeps it at the player's position and speed through play, pause, seek and speed changes.
active, from the window's own reports that it opened and closed.
Building it can fail for a reason that is not an error: a device that does not offer the feature. createOrNull answers null rather than throwing at the moment a viewer is trying to leave the app.
On iOS the application still declares the background audio capability itself; without it the window appears and freezes as soon as the app is no longer on screen. Pass this object to attachBackgroundHandling in kiteplayer, so video keeps playing in the window while the app is away.
Use every member from the main thread.
Properties
True when the system is willing right now. It can change with the device's state.
Called when the viewer asks to go back to the app from the window.
Whether the window opens by itself when the viewer leaves the app while playing.
Functions
Asks for the window. Does nothing when the system is not willing; check isPossible.